var path = require('path')
import generator from './../generator';
const configPath = {
    out: path.resolve(__dirname, `../../../code-client/src/`),
    tem: path.resolve(__dirname, '../../../src/tem/vue/')
}

export default async function start(datas) {   
   
       
    datas.forEach(data => {        
        generator(data, "add.vue", `views/${data.tableName}/add.vue`, configPath);
        generator(data, "edit.vue", `views/${data.tableName}/edit.vue`, configPath);
        generator(data, "list.vue", `views/${data.tableName}/list.vue`, configPath);
        generator(data, "query.vue", `views/${data.tableName}/query.vue`, configPath);
        generator(data, "api.vue", `api/${data.tableName}.js`, configPath);
    });    
    generator({tables:datas}, "lang.vue", "lang.js", configPath);
    generator({tables:datas}, "route.vue", "route.js", configPath);
    // generator({tables:datas}, "sider.vue", "components/common/Sidebar.vue", configPath);
    // generator({tables:datas}, "route.vue", "router/index.js", configPath);
}
